package com.mitaotao._1_语法._3_分支._3_if判断;

import java.util.Scanner;

public class _02_根据输入的x的值输出Y_1 {
    public static void main(String[] args) {
        //输入的x<-1时，输出y为-1;
        //输入的x=0时，输出y为0;
        //输入的x>1时，输出y为1;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入数字：");
        int x = scanner.nextInt();
        int y = 0;

        if (x>1) {
            y=1;
        }
        else if (x==0) {
            y=0;
        }
        else{
            y=-1;
        }
        System.out.println("y="+y);
        scanner.close();
    }
}
